﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

using AutoFacUtils;
using CashFlow.Db.Entity;
using CashFlow.ShopManage.Common;
using CashFlow.ShopManage.Models;
using CashFlow.ShopManage.Validator;
using CashFlow.ShopManage.Service;

namespace CashFlow.ShopManage.Controllers
{
    public class ShopController : Controller
    {
        private IAdminService GetAdminService() { return AutoFacHelper.Get<IAdminService>(); }
        private IShopService GetShopService() { return AutoFacHelper.Get<IShopService>(); }
        private IUserService GetUserService() { return AutoFacHelper.Get<IUserService>(); }

        // GET: Shop
        public ActionResult Index()
        {
            var adminService = GetAdminService();
            var ui = adminService.GetLoginUserInfo();
            var shopService = GetShopService();
            var ui2 = shopService.QuerySingle(x => x.ShopManagerUserId == ui.ShopManagerUserId);
            var userService = GetUserService();
            var ui3 = userService.QuerySingleById(ui.ShopManagerUserId);
            ViewBag.ShopInfo = ui2;
            ViewBag.UserInfo = ui3;

            return View();
        }
    }
}